package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.controller.NursingProjectController;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/orders/project")
public class CustomerOrderController extends BaseController {
    @Autowired
    private NursingProjectService nursingProjectService;
    @GetMapping("/page")
    public ResponseResult<NursingProjectVo> findByPage(
            @RequestParam(name = "name",required = false)String name,
            @RequestParam(name = "status",required = false)Integer status,
            @RequestParam(name = "pageNum",defaultValue = "1")Integer pageNum,
            @RequestParam(name = "pageSize",defaultValue = "10")Integer pageSize
            ){
        PageResponse<NursingProjectVo> vo = nursingProjectService.findByPage(name, status, pageNum, pageSize);
        return success(vo);
    }

    @GetMapping("/{id}")
    public ResponseResult<NursingProjectVo> findById(
            @PathVariable(name = "id")Long id
            ){
        NursingProjectVo vo = nursingProjectService.findById(id);
        return success(vo);
    }
}
